package com.fengdi.everyday.middle;

/**
 * @Description 执行操作后的最大MEX
 * @Date 08:52
 */
public class FindSmallestInteger {
    public int findSmallestInteger(int[] nums, int value) {
        int[] mp = new int[value];
        for (int num : nums) {
            int v = ((num % value) + value) % value;
            mp[v]++;
        }
        
        int mex = 0;
        while (mp[mex % value] > 0) {
            mp[mex % value]--;
            mex++;
        }
        return mex;
    }
}
